/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package DB;


import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author Dan dotcom & JuanNet
 */
public class DbLogin {
    Db db;
    public int key=0;
    public String oper="";
    public ResultSet re;
    public DbLogin(String _Query, String _Tabla) {
        db = new Db();
        if(db.ok == true){
            Insert(_Query, _Tabla);
        }else{
            System.out.println("Error de conexion!");
        }
    }
    private void Insert(String Query, String columna){
        boolean value = true;
            Statement stmt;
            try {
            stmt = db.c.createStatement();
            re = stmt.executeQuery(Query);
            
              System.out.println(re.getString(columna));
              oper=(re.getString(columna));
           
            stmt.close();
            db.c.commit();
            db.c.close();
            } catch ( SQLException ex ) {
              value = false;
              System.err.println(ex.getMessage());
            }
            if (value == true)
            {
                System.out.println("Operacion exitosa!");
            }
            else
            {
                System.out.println("Operacion fallida!");
            }
        
         
    }
}